Skip to contentSkip to conversation

Change in openvpn[master]: Mention address if not unspecific on DNS failure

Openvpn-devel Superseded plaisthos (Code Review) 2 participants 13 messages Mar 17, 2025 – Mar 25, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1742224441000.I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5@...2715...

#1 lore raw

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/909?usp=email

to review the following change.

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Mention address if not unspecific on DNS failure

With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier.

Change-Id I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5

---
M src/openvpn/socket.c

1 file changed, 21 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/09/909/1

src/openvpn/socket.c +21 -2
index 6b32e30..24c414d 100644
@@ -445,6 +445,22 @@
     throw_signal_soft(SIGHUP, "Preresolving failed");
 }
 
+/**
+ * Small helper function for openvpn_getaddrinfo to print the address
+ * family when resolving fails
+ */
+static const char *
+gettaddrinfo_addr_family_name(int af)
+{
+    switch (af)
+    {
+        case AF_INET:  return "[AF_INET]";
+
+        case AF_INET6: return "[AF_INET6]";
+    }
+    return "";
+}
+
 /*
  * Translate IPv4/IPv6 addr or hostname into struct addrinfo
  * If resolve error, try again for resolve_retry_seconds seconds.
@@ -545,11 +561,11 @@
             print_hostname = "undefined";
         }
 
-        fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
+        fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
         if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
             && !resolve_retry_seconds)
         {
-            fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
+            fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s) %s"
                   "(I would have retried this name query if you had "
                   "specified the --resolv-retry option.)";
         }
@@ -561,6 +577,8 @@
             goto done;
         }
 
+
+
 #ifdef ENABLE_MANAGEMENT
         if (flags & GETADDR_UPDATE_MANAGEMENT_STATE)
         {
@@ -639,6 +657,7 @@
                 fmt,
                 print_hostname,
                 print_servname,
+                gettaddrinfo_addr_family_name(ai_family),
                 gai_strerror(status));
 
             if (--resolve_retries <= 0)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/909?usp=email )

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Patch Set 1: Code-Review-1

(4 comments)

Patchset:

PS1:
details

File src/openvpn/socket.c:

http://gerrit.openvpn.net/c/openvpn/+/909/comment/29ff33c4_efbe7f78 :
PS1, Line 453: gettaddrinfo_addr_family_name(int af)
is the "double t" intentional? gettaddrinfo?

http://gerrit.openvpn.net/c/openvpn/+/909/comment/9dc345c2_18bf229f :
PS1, Line 581:
intentional extra blank line?

http://gerrit.openvpn.net/c/openvpn/+/909/comment/28600d47_bc36aa79 :
PS1, Line 660: gettaddrinfo_addr_family_name(ai_family),
double "t"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 24 Mar 2025 18:38:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/909?usp=email )

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Patch Set 1:

(3 comments)

File src/openvpn/socket.c:

http://gerrit.openvpn.net/c/openvpn/+/909/comment/6529663b_69928b7d :
PS1, Line 453: gettaddrinfo_addr_family_name(int af)

Quoted 1 line

is the "double t" intentional? gettaddrinfo?

no, wil fix.

http://gerrit.openvpn.net/c/openvpn/+/909/comment/048e756c_48e56f66 :
PS1, Line 581:

Quoted 1 line

intentional extra blank line?

Acknowledged

http://gerrit.openvpn.net/c/openvpn/+/909/comment/ccb3ef36_580e41de :
PS1, Line 660: gettaddrinfo_addr_family_name(ai_family),

Quoted 1 line

double "t"

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 25 Mar 2025 09:05:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld.

Hello cron2, flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/909?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review-1 by cron2

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Mention address if not unspecific on DNS failure

With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier.

Change-Id I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5

---
M src/openvpn/socket.c

1 file changed, 20 insertions(+), 3 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/09/909/2

src/openvpn/socket.c +20 -3
index 6b32e30..c5ed6b8 100644
@@ -445,6 +445,22 @@
     throw_signal_soft(SIGHUP, "Preresolving failed");
 }
 
+/**
+ * Small helper function for openvpn_getaddrinfo to print the address
+ * family when resolving fails
+ */
+static const char *
+getaddrinfo_addr_family_name(int af)
+{
+    switch (af)
+    {
+        case AF_INET:  return "[AF_INET]";
+
+        case AF_INET6: return "[AF_INET6]";
+    }
+    return "";
+}
+
 /*
  * Translate IPv4/IPv6 addr or hostname into struct addrinfo
  * If resolve error, try again for resolve_retry_seconds seconds.
@@ -545,11 +561,11 @@
             print_hostname = "undefined";
         }
 
-        fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
+        fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
         if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
             && !resolve_retry_seconds)
         {
-            fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
+            fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s) %s"
                   "(I would have retried this name query if you had "
                   "specified the --resolv-retry option.)";
         }
@@ -639,7 +655,8 @@
                 fmt,
                 print_hostname,
                 print_servname,
-                gai_strerror(status));
+                getaddrinfo_addr_family_name(ai_family),
+                ai_strerror(status));
 
             if (--resolve_retries <= 0)
             {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld.

Hello cron2, flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/909?usp=email

to look at the new patch set (#3).

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Mention address if not unspecific on DNS failure

With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier.

Change-Id I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5

---
M src/openvpn/socket.c

1 file changed, 19 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/09/909/3

src/openvpn/socket.c +19 -2
index 6b32e30..bea5393 100644
@@ -445,6 +445,22 @@
     throw_signal_soft(SIGHUP, "Preresolving failed");
 }
 
+/**
+ * Small helper function for openvpn_getaddrinfo to print the address
+ * family when resolving fails
+ */
+static const char *
+getaddrinfo_addr_family_name(int af)
+{
+    switch (af)
+    {
+        case AF_INET:  return "[AF_INET]";
+
+        case AF_INET6: return "[AF_INET6]";
+    }
+    return "";
+}
+
 /*
  * Translate IPv4/IPv6 addr or hostname into struct addrinfo
  * If resolve error, try again for resolve_retry_seconds seconds.
@@ -545,11 +561,11 @@
             print_hostname = "undefined";
         }
 
-        fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
+        fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
         if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
             && !resolve_retry_seconds)
         {
-            fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
+            fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s) %s"
                   "(I would have retried this name query if you had "
                   "specified the --resolv-retry option.)";
         }
@@ -639,6 +655,7 @@
                 fmt,
                 print_hostname,
                 print_servname,
+                getaddrinfo_addr_family_name(ai_family),
                 gai_strerror(status));
 
             if (--resolve_retries <= 0)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/909?usp=email )

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Patch Set 3: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 25 Mar 2025 10:54:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#7 lore raw

PATCH v3 1/1 Mention address if not unspecific on DNS failure

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier.

Change-Id I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/909
This mail reflects revision 3 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/socket.c +19 -2
index 6b32e30..bea5393 100644
@@ -445,6 +445,22 @@
     throw_signal_soft(SIGHUP, "Preresolving failed");
 }
 
+/**
+ * Small helper function for openvpn_getaddrinfo to print the address
+ * family when resolving fails
+ */
+static const char *
+getaddrinfo_addr_family_name(int af)
+{
+    switch (af)
+    {
+        case AF_INET:  return "[AF_INET]";
+
+        case AF_INET6: return "[AF_INET6]";
+    }
+    return "";
+}
+
 /*
  * Translate IPv4/IPv6 addr or hostname into struct addrinfo
  * If resolve error, try again for resolve_retry_seconds seconds.
@@ -545,11 +561,11 @@
             print_hostname = "undefined";
         }
 
-        fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
+        fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
         if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
             && !resolve_retry_seconds)
         {
-            fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
+            fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s) %s"
                   "(I would have retried this name query if you had "
                   "specified the --resolv-retry option.)";
         }
@@ -639,6 +655,7 @@
                 fmt,
                 print_hostname,
                 print_servname,
+                getaddrinfo_addr_family_name(ai_family),
                 gai_strerror(status));
 
             if (--resolve_retries <= 0)
#8 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

Hello cron2, flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/909?usp=email

to look at the new patch set (#4).

The following approvals got outdated and were removed:
Code-Review+2 by cron2

The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Mention address if not unspecific on DNS failure

With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier.

Change-Id I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5

---
M src/openvpn/socket.c

1 file changed, 19 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/09/909/4

src/openvpn/socket.c +19 -2
index 6b32e30..09de1b0 100644
@@ -445,6 +445,22 @@
     throw_signal_soft(SIGHUP, "Preresolving failed");
 }
 
+/**
+ * Small helper function for openvpn_getaddrinfo to print the address
+ * family when resolving fails
+ */
+static const char *
+getaddrinfo_addr_family_name(int af)
+{
+    switch (af)
+    {
+        case AF_INET:  return "[AF_INET]";
+
+        case AF_INET6: return "[AF_INET6]";
+    }
+    return "";
+}
+
 /*
  * Translate IPv4/IPv6 addr or hostname into struct addrinfo
  * If resolve error, try again for resolve_retry_seconds seconds.
@@ -545,11 +561,11 @@
             print_hostname = "undefined";
         }
 
-        fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
+        fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
         if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
             && !resolve_retry_seconds)
         {
-            fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
+            fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)"
                   "(I would have retried this name query if you had "
                   "specified the --resolv-retry option.)";
         }
@@ -639,6 +655,7 @@
                 fmt,
                 print_hostname,
                 print_servname,
+                getaddrinfo_addr_family_name(ai_family),
                 gai_strerror(status));
 
             if (--resolve_retries <= 0)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#9 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/909?usp=email )

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Patch Set 4: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 25 Mar 2025 19:57:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#10 lore raw

PATCH v4 1/1 Mention address if not unspecific on DNS failure

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier.

Change-Id I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/909
This mail reflects revision 4 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/socket.c +19 -2
index 6b32e30..09de1b0 100644
@@ -445,6 +445,22 @@
     throw_signal_soft(SIGHUP, "Preresolving failed");
 }
 
+/**
+ * Small helper function for openvpn_getaddrinfo to print the address
+ * family when resolving fails
+ */
+static const char *
+getaddrinfo_addr_family_name(int af)
+{
+    switch (af)
+    {
+        case AF_INET:  return "[AF_INET]";
+
+        case AF_INET6: return "[AF_INET6]";
+    }
+    return "";
+}
+
 /*
  * Translate IPv4/IPv6 addr or hostname into struct addrinfo
  * If resolve error, try again for resolve_retry_seconds seconds.
@@ -545,11 +561,11 @@
             print_hostname = "undefined";
         }
 
-        fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
+        fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
         if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
             && !resolve_retry_seconds)
         {
-            fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
+            fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)"
                   "(I would have retried this name query if you had "
                   "specified the --resolv-retry option.)";
         }
@@ -639,6 +655,7 @@
                 fmt,
                 print_hostname,
                 print_servname,
+                getaddrinfo_addr_family_name(ai_family),
                 gai_strerror(status));
 
             if (--resolve_retries <= 0)
#11 lore raw

[Openvpn-devel] [PATCH applied] Re: Mention address if not unspecific on DNS failure

Stared at it, and tested, and it's indeed quite useful (v3 had a stray "%s" which is fixed in v4).

Without the patch, trying with "--local <v6 address>" + "--remote <v4only>"

RESOLVE: Cannot resolve host address: v4only.v6.de:51194 (No address associated with hostname)

with the patch:

RESOLVE: Cannot resolve host address: v4only.v6.de:51194[AF_INET6] (No address associated with hostname)

so when trying to diagnose user reports, this immediately points to "mmmh, something is forcing v6 here, why?".

With no --local and no --proto udp4, nothing is forced, and thus:

RESOLVE: Cannot resolve host address: nix.v6.de:51194 (Name or service not known)

Your patch has been applied to the master branch.

commit d16781531898b4c5a76cfe6cba02fccce9afb8ad

Author: Arne Schwabe
Date:   Tue Mar 25 20:57:43 2025 +0100
     Mention address if not unspecific on DNS failure

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg31237.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#12 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#5) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/909?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Mention address if not unspecific on DNS failure

With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier.

Change-Id I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31237.html

---
M src/openvpn/socket.c

1 file changed, 19 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/09/909/5

src/openvpn/socket.c +19 -2
index 6b32e30..09de1b0 100644
@@ -445,6 +445,22 @@
     throw_signal_soft(SIGHUP, "Preresolving failed");
 }
 
+/**
+ * Small helper function for openvpn_getaddrinfo to print the address
+ * family when resolving fails
+ */
+static const char *
+getaddrinfo_addr_family_name(int af)
+{
+    switch (af)
+    {
+        case AF_INET:  return "[AF_INET]";
+
+        case AF_INET6: return "[AF_INET6]";
+    }
+    return "";
+}
+
 /*
  * Translate IPv4/IPv6 addr or hostname into struct addrinfo
  * If resolve error, try again for resolve_retry_seconds seconds.
@@ -545,11 +561,11 @@
             print_hostname = "undefined";
         }
 
-        fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
+        fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
         if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
             && !resolve_retry_seconds)
         {
-            fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
+            fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)"
                   "(I would have retried this name query if you had "
                   "specified the --resolv-retry option.)";
         }
@@ -639,6 +655,7 @@
                 fmt,
                 print_hostname,
                 print_servname,
+                getaddrinfo_addr_family_name(ai_family),
                 gai_strerror(status));
 
             if (--resolve_retries <= 0)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#13 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/909?usp=email )

Change subject: Mention address if not unspecific on DNS failure
......................................................................

Mention address if not unspecific on DNS failure

With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier.

Change-Id I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31237.html

---
M src/openvpn/socket.c

1 file changed, 19 insertions(+), 2 deletions(-)
src/openvpn/socket.c +19 -2
index 6b32e30..09de1b0 100644
@@ -445,6 +445,22 @@
     throw_signal_soft(SIGHUP, "Preresolving failed");
 }
 
+/**
+ * Small helper function for openvpn_getaddrinfo to print the address
+ * family when resolving fails
+ */
+static const char *
+getaddrinfo_addr_family_name(int af)
+{
+    switch (af)
+    {
+        case AF_INET:  return "[AF_INET]";
+
+        case AF_INET6: return "[AF_INET6]";
+    }
+    return "";
+}
+
 /*
  * Translate IPv4/IPv6 addr or hostname into struct addrinfo
  * If resolve error, try again for resolve_retry_seconds seconds.
@@ -545,11 +561,11 @@
             print_hostname = "undefined";
         }
 
-        fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
+        fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
         if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
             && !resolve_retry_seconds)
         {
-            fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
+            fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)"
                   "(I would have retried this name query if you had "
                   "specified the --resolv-retry option.)";
         }
@@ -639,6 +655,7 @@
                 fmt,
                 print_hostname,
                 print_servname,
+                getaddrinfo_addr_family_name(ai_family),
                 gai_strerror(status));
 
             if (--resolve_retries <= 0)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/909?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5
Gerrit-Change-Number: 909
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged